home *** CD-ROM | disk | FTP | other *** search
- /* lrotr.c function, from p.223 of turbo c bible */
- #include<stdio.h>
- #include<stdlib.h>
- main(int argc , char **argv)
- {
- int bits;
- unsigned long value;
- char **eptr;
- if (argc < 3)
- {
- printf("Usage: %s <hex value (max 8 digits)>"
- "<no. bits to rotate right > \n",argv[0]);
- exit(0);
- }
- value = strtoul(argv[1], eptr, 16);
- bits = atoi(argv[2]);
- printf("%#8.8lx rotated right by %d bits = %#8.8lx\n",
- value, bits, _lrotr(value, bits));
- }